char * left(char query[],int limit)         
{
char a[10];
int i=0,j=0;
while(query[i]!='\0'&&j<limit)
a[j++]=query[i++];
a[j]='\0';
return a;
}

char * right(char query[],int limit)
{
char a[10];
int i=strlen(query)-limit,j=0;
while(query[i]!='\0')
a[j++]=query[i++];
a[j]='\0';
return a;
}

char * split(char str[],char token)     
{
char *ptokens[20],*temp;
int i=0,k=0,state=1;             /* state is used when two spaces occur in the string */
do
{
for(;str[i]!=token&&str[i]!='\0';i++)
{
temp=malloc(20);
*temp++=str[i];
state=0;
}
if(!state)
{
*temp='\0';
ptokens[k++]=temp;
}
state=1;
}while(str[i++]!='\0');
ptokens[k]='\0';
return ptokens;
}